
<style>
    <style>

    .layui-form-label{ font-size: 15px}
    .layui-input-inline{ width: 70%!important; margin-top: 2px;}
    .layui-form-select{ width: 75px;float: left}px
                                                .layui-select-title{width: 100px}
    .mylayui-input{  float: left;margin-left: 5px;width: 120px}
    .mylabel {text-align: left; margin-left: 15px;
        width: 140px;
        line-height: 9px;
        padding: 9px 5px;
    }
    .layui-form-switch {
        margin-top: 5px;
        float: left;
    }


    #test7 .layui-form-label{width: 100px}
    #test7 .layui-unselect{width: 80px}



    /*     .x-admin-sm .layui-input{ height: 38px;}*/

</style>
<body>

<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form" lay-filter="formdata">
            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    <span class="x-red">*</span>配置名</label>
                <div class="layui-input-inline">
                    <input type="text" id="titel" name="titel" required=""  autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">
                    <span class="x-red">*</span>配置功能码</label>
                <div class="layui-input-inline">
                    <input type="text" id="name" name="name" required=""  autocomplete="off" class="layui-input">
                </div>
            </div>



            <div class="newbox">



            </div>
            <div>



                <div class="layui-form-item">
                    <div style="margin-left: 100px" class="layui-btn addnew" >添加新参数</div></div>
                <div style="margin-left: 100px" class="layui-btn" lay-filter="add" lay-submit="">确认</div></div>





        </form>
    </div>
</div>
<script>

    var info = parent.info;
    var i=0;


    console.log(info);
    layui.use(['form', 'layer','jquery','upload'],
        function() {
            $ = layui.jquery;
            var form = layui.form,
                layer = layui.layer,
                upload = layui.upload;

        /*   var value=info.value2;
            value=JSON.parse(value);
            $("#loginname").val(info.titel);*/

            $(".addnew").click(function (){
                var html=' <div class="layui-form-item">' +
                    '                    <label class="layui-form-label">新参数</label>' +
                    '                    <div class="layui-input-inline">' +
                    '                        <input type="text" name="key['+i+']"  placeholder="请输入新参数key" class="layui-input">' +
                    '                    </div>' +
                    '                    <div class="layui-input-inline">' +
                    '                        <input type="text"  name="value['+i+']"  placeholder="请输入新参数vallue" style="margin-left: 110px" class="layui-input">' +
                    '                    </div>' +
                    '                    <div class="layui-input-inline">' +
                    '                        <input type="text"  name="remark['+i+']" placeholder="请输入新参数备注"  style="margin-left: 110px"  class="layui-input">' +
                    '                    </div>' +
                    '                </div>';

                $(".newbox").append(html);
                i++;
                form.render();
            });



         


            
            form.render();





            //监听提交
            form.on('submit(add)',
                function(data) {
                    var url = baseurl+'/Customer/addconfigdo';
                    // url='https://admin.huidianshang.com/index.do'

                    var postdata = form.val('formdata');





                    $.post(url, postdata, function (data) {

                        if(data.code==0){
                            layer.alert("添加成功", {
                                    icon: 6
                                },
                                function() {
                                    //关闭当前frame
                                    xadmin.close();

                                    // 可以对父窗口进行刷新
                                    xadmin.father_reload();
                                });
                        }else{
                            layer.msg("添加失败")
                        }


                    }, 'json');
                    //发异步，把数据提交给php

                    return false;
                });

        });</script>

</body>